package com;

import com.controller.ApolloController;
import com.config.UserConfigration;
import com.ctrip.framework.apollo.spring.annotation.EnableApolloConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

//@EnableAutoConfiguration
@EnableApolloConfig
@RestController
@SpringBootApplication
@EnableConfigurationProperties({UserConfigration.class})
//@ComponentScan(value = {"com"})
public class App {

	private static Logger logger = LoggerFactory.getLogger(App.class);

	@Autowired
	BeanFactory beanFactory;

	@Autowired
	@RequestMapping("/")
	String home() {
		return beanFactory.getBean(UserConfigration.class).toString();
//		return beanFactory.getBean(MainaController.class).print();
	}

	public static void main(String[] args) {
		SpringApplication.run(App.class, args);
		logger.trace("---------------trace:end App--------------");
		logger.debug("---------------debug:end App--------------");
		logger.info("---------------info:end App--------------");
		logger.warn("---------------warn:end App--------------");
	}
}
